<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function add1(a,b,c){
            return a+b+c;
        }
       console.log(add1(1,2,3));
       function add2(a){
        return function(b){
            return function(c){
                return a+b+c
            }
        }
       }
       add2(1)(2)(3);
       function addUrl1(protocol, host, port) {
        return `${protocol}://${host}:${port}`;
      }
      addUrl1("http", "127.0.0.1", "8888");
      addUrl1("http", "127.0.0.1", "6666");
      addUrl1("http", "localhost", "3000");
      addUrl1("http", "localhost", "3300");

      //把上边函数改为函数柯里化写法
      function addUrl2(protocol) {
        return function (host) {
          return function (port) {
            return `${protocol}://${host}:${port}`;
          };
        };
      }

      const proUrl2 = addUrl2("http");
      console.log(proUrl2("127.0.0.1")(8888));
      console.log(proUrl2("127.0.0.1")(6666));
      console.log(proUrl2("127.0.0.1")(5555));

      const proHostUrl2 = proUrl2("localhost");
      console.log(proHostUrl2(1234));
      console.log(proHostUrl2(12345));
    </script>
</body>
</html>